package org.ucas.kgraph.utils.exception;

import org.springframework.http.HttpStatus;
import org.ucas.kgraph.utils.constants.ErrCode;

/**
 * 请求非法或不合规范类异常
 * @author suemi
 */
public class BadRequestException extends RestException{

  public static final BadRequestException stateError =
          new BadRequestException(ErrCode.STATE_ERROR);

  public static final BadRequestException Root_Defect =
          new BadRequestException(ErrCode.ROOT_DEFECT);

  public static final BadRequestException Definition_Defect =
          new BadRequestException(ErrCode.DEFINITION_DEFECT);
  
  public static final BadRequestException Perm_Defect =
          new BadRequestException(ErrCode.PERM_DEFECT);
  public static final BadRequestException File_LevelMuch =
          new BadRequestException(ErrCode.File_LevelMuch);
  
  private BadRequestException(ErrCode code) {
    super(code);
  }

  public static BadRequestException of(String msg) {
    return new BadRequestException(new ErrCode(
            HttpStatus.BAD_REQUEST, msg));
  }
}
